<template>
  <Teleport :to="teleport" :disabled="!teleport">
    <div
      class="loading"
      :style="!teleport || teleport !== 'body' ? { position: 'absolute' } : {}"
    >
      <a-spin :tip="text" />
    </div>
  </Teleport>
</template>
<script lang="ts" setup>
import { TeleportProps } from "vue";
defineProps<{
  text?: string;
  teleport?: TeleportProps["to"];
}>();
</script>
<style lang="css" scoped>
.loading {
  position: fixed;
  color: #6f7385;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  background-color: rgba(240, 242, 245, 0.5);
}
</style>
